﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TestPages_testDatabase : System.Web.UI.Page
{
    TestDatabaseManager tdb = new TestDatabaseManager();

    private static bool initialized = false;

    private void init()
    {
        TextBox1.ReadOnly = true;
        TextBox2.ReadOnly = true;
        TextBox1.Text = (initialized = tdb.connect()) ? "connected" : "connection failed";
    }

    private void showTest(string test_name, bool result)
    {
        TextBox2.Text += test_name + ": " + result + "\n";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!initialized)
            init();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        showTest("saveAccount", tdb.testSaveAccount());
        showTest("savePerson", tdb.testSavePerson());
        showTest("editPerson", tdb.testEditPerson());
        showTest("getPerson", tdb.testGetPerson());
        showTest("removePerson", tdb.testRemovePerson());
        showTest("removeAccount", tdb.testRemoveAccount());
        // showTest("getPersons", tdb.testGetPersons());
    }

}
